@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">修改密码</div>
                <div class="panel-body">
                    <form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}">
                        {!! csrf_field() !!}

                        <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">已绑定手机号</label>

                            <div class="col-md-6">
                                <input id="mobile" type="text" class="form-control" name="name" value="18782226829" disabled="disabled">
                            </div>
                        </div>
						<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">验证码</label>

                            <div class="col-md-6">
                                <input type="code" class="form-control registerborderrr registerinputwidth" name="code" value="{{ old('code') }}">
								<button id="Verification" type="button" class="btn btn-primary registercodewidth registerborderrl">获取验证码</button>
                                @if ($errors->has('code'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('code') }}</strong>
                                    </span>
                                @endif
                            </div>
							<script type="text/javascript">
                            	$("#Verification").click(function(){
									var mobile=$('#mobile').val();
									var reg=/^1[3|4|5|7|8]\d{9}$/;
									if (reg.exec(mobile)==null) {
										$('#mobilebox').addClass('has-error');
										return false;
									}else{
										$('#mobilebox').removeClass('has-error');
									}
									
									setInt();
//									var url="{:U('User/send_verify')}";
//									$.post(url,{mobile:mobile},function(data){
//										if(data.status){
//											setInt();
//										}else{
//											$(".msg").html(data.msg);
//											$('#GetCode').addClass('click');
//										}
//									},'json')
								})
								var count=60;
								var curCount;
								var objTime;
								function setTime(){
									if (curCount==0) {
										clearInterval(objTime);
										$('#Verification').removeAttr('disabled');
										$('#Verification').html('重发验证码');
									}else{
										curCount--;
										$('#Verification').html(curCount + "秒后重发")
									}
								}
								function setInt() {
									curCount=count;
									$('#Verification').attr('disabled','true');
									objTime=setInterval(setTime,1000);
								}
                            </script>
                        </div>

                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">密码</label>

                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password">

                                @if ($errors->has('password'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
                            <label class="col-md-4 control-label">确认密码</label>

                            <div class="col-md-6">
                                <input type="password" class="form-control" name="password_confirmation">

                                @if ($errors->has('password_confirmation'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password_confirmation') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-4">
                                <button type="submit" class="btn btn-primary btn-lg btn-block">
                                    <i class="fa fa-btn fa-user"></i>确认重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
